When the guest shuts down a VM, make sure that the domain gets destroyed.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 11 Aug 2005 21:06:15 +0000 (21:06 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 11 Aug 2005 21:06:15 +0000 (21:06 +0000)
Device model needs to do xm destroy before it exits on
guest shutdown/poweroff/halt -p.

Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
tools/ioemu/monitor.c
tools/ioemu/target-i386-dm/helper2.c

index 677f9b6d857c6ae2ffd2dbd2af1946ec7468f4ec..43304ea253228a84f8446c5e19585cdcab715937 100644 (file)
@@ -225,14 +225,10 @@ static void do_info_history (void)
     }
 }
 
+extern void destroy_vmx_domain(void);
 static void do_quit(void)
 {
-    extern int domid;
-    extern FILE* logfile;
-    char destroy_cmd[20];
-    sprintf(destroy_cmd, "xm destroy %d", domid);
-    if (system(destroy_cmd) == -1)
-        fprintf(logfile, "%s failed.!\n", destroy_cmd);
+    destroy_vmx_domain();
     exit(0);
 }
 
index 361a2bbe9efcbb4da5a2d33034bd8934fe10775b..5cbeb88aeb7912cc0b471d123a1e2729c452eddb 100644 (file)
@@ -328,7 +328,16 @@ do_interrupt(CPUState *env, int vector)
        env->send_event = 1;
 }
 
-//static unsigned long tsc_per_tick = 1; /* XXX: calibrate */
+void
+destroy_vmx_domain(void)
+{
+    extern int domid;
+    extern FILE* logfile;
+    char destroy_cmd[20];
+    sprintf(destroy_cmd, "xm destroy %d", domid);
+    if (system(destroy_cmd) == -1)
+        fprintf(logfile, "%s failed.!\n", destroy_cmd);
+}
 
 int main_loop(void)
 {
@@ -396,6 +405,7 @@ int main_loop(void)
                        }
                }
        }
+        destroy_vmx_domain();
        return 0;
 }